package Socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Client2 {
    private Socket socket;
    public Client2(){

        try {
            System.out.println("正在链接服务端...");
            socket=new Socket("localhost",8080);
            System.out.println("链接服务端成功！");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    public void start(){
        try {
            OutputStream out=socket.getOutputStream();
            out.write(1);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        Client2 client=new Client2();
        client.start();
    }
}
